<div class="form-group">
    <label class="col-sm-2 control-label">排序</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <input type="text" class="form-control" name="displayorder" value="{$item['displayorder']}" data-rule-required="true"/>
        {else}
        <div class="form-control-static">
            {$item['displayorder']}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">门店名称</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <input type="text" class="form-control" name="mendianname" value="{$item['mendianname']}" data-rule-required="true"/>
        {else}
        <div class="form-control-static">
            {$item['mendianname']}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">营业执照编码</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <input type="text" class="form-control" name="mdcode" value="{$item['mdcode']}" data-rule-required="true"/>
        {else}
        <div class="form-control-static">
            {$item['mdcode']}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">门店编号</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <input type="text" class="form-control" name="mdnumber" value="{$item['mdnumber']}" data-rule-required="true"/>
        {else}
        <div class="form-control-static">
            {$item['mdnumber']}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">商品税收</label>
    <div class="col-sm-3">
        {ifp 'mendian.edit'}
        <div class="input-group">
            <input type="text" name="goodstax" class="form-control" value="{$item['goodstax']}" data-rule-required="true">
            <span class="input-group-addon">%</span>
        </div>
        {else}
        <div class="form-control-static">
            {$item['goodstax']}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">所属行业</label>
    <div class="col-sm-8">
        {ifp 'md_service.edit'}
        <select id="sel-platform" name="platform" class="select form-control" style="width:130px;display:inline;">
            <option value="0">请选择平台</option>
            {loop $platform $row}
            <option value="{$row['id']}" {if $industry['platformid'] == $row['id']}selected="selected"{/if}>{$row['name']}</option>
            {/loop}
        </select>

        <select id="sel-industry" name="industryid" class="select form-control" style="width:130px;display:inline;">
            {loop $industryall $row}
            <option value="{$row['id']}" {if $industry['id'] == $row['id']}selected="selected"{/if}>{$row['name']}</option>
            {/loop}
        </select>
        {else}
        <div class="form-control-static">
            {$item['industryid']}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label must">所属分类</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <select class="form-control" name="mdcateid">
            <option value="0">请选择分类</option>
            {loop $md_fenlei $c}
            <option value="{$c['id']}" {if $item['mdcate_id']==$c['id']}selected{/if}>{$c['name']}</option>
            {/loop}
        </select>

        {else}
        <div class="form-control-static">
            {loop $category $c}
            {if $item['mdcate_id']==$c['id']}{$c['name']}{/if}
            {/loop}
        </div>
        {/if}
    </div>
</div>

<div class="form-group" style="display: none">
    <label class="col-sm-2 control-label must">所属商户</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <select class="form-control" name="merchid">
            <option value="0">请选择商户</option>
            {loop $merch $c}
            <option value="{$c['id']}" {if $item['merchid']==$c['id']}selected{/if}>{$c['merchname']}</option>
            {/loop}
        </select>

        {else}
        <div class="form-control-static">
            {$inmerch['merchname']}
        </div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">门店电话</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <input type="text" name="tel" class="form-control" value="{$item['tel']}" />
        {else}
        <div class='form-control-static'>{$item['tel']}</div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">门店地址</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <input type="text" name="address" class="form-control" value="{$item['address']}" />
        {else}
        <div class='form-control-static'>{$item['address']}</div>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">门店位置</label>
    <div class="col-sm-9 col-xs-12">
        {ifp 'mendian.edit'}
        {php echo tpl_form_field_coordinate('location',array('lng'=>$item['lng'],'lat'=>$item['lat']))}
        {else}
        <div class='form-control-static'>lng={$item['lng']},lat={$item['lat']}</div>
        {/if}
    </div>
</div>

<div class="form-group offline" id="address_div" >
    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
    <div class="col-sm-7 col-xs-12">
        {ifp 'mendian.edit'}
        {if empty($opid)}{$item['province']}
        <span id="address2" >{$item['city']} {$item['dist']} {$item['town']} {$item['street']}</span>
        <input type="hidden" name="province" id="province" value="{$item['province']}" />
        <input type="hidden" name="city" id="city" value="{$item['city']}" />
        <input type="hidden" name="dist" id="dist" value="{$item['dist']}" />
        <input type="hidden" name="town" id="town" value="{$item['town']}" />
        <input type="hidden" name="street" id="street" value="{$item['street']}" />
        {else}
        {$operator['province']}
        <input type="hidden" name="province" value="{$operator['province']}" />

        {if $operator['type'] == 2}
        {$operator['city']} {$operator['dist']}
        <input type="hidden" name="city" value="{$operator['city']}" />
        <input type="hidden" name="dist" value="{$operator['dist']}" />
        {/if}

        {/if}
        {else}
        <span>{$item['province']} {$item['city']} {$item['dist']} {$item['town']} {$item['street']}</span>
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">门店宣传图</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        {php echo tpl_form_field_image('thumb',$item['thumb'],'../addons/mx_shop/static/images/nopic.jpg')}
        <span class="help-block">门店宣传图 建议尺寸 300 * 300</span>
        {else}
        {if empty($item['thumb'])}
        <img src="../addons/mx_shop/static/images/nopic.jpg" onerror="this.src='../addons/mx_shop/static/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
        {else}
        <img src="{php echo tomedia($item['thumb'])}" onerror="this.src='../addons/mx_shop/static/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
        {/if}
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">门店图册</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        {php echo tpl_form_field_multi_image('tuce',$item['tuce'])}
        {else}
        {loop $item['tuce'] $val}
        <img src="{php echo tomedia($val)}" onerror="this.src='../addons/mx_shop/static/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="100">
        {/loop}
        {/if}
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">门店描述</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        {php echo tpl_ueditor('description',$item['description'])}
        {else}
        <div class="form-control-static">{$item['description']}</div>
        {/if}
    </div>
</div>

<div class="form-group-title">状态</div>
<div class="form-group">
    <label class="col-sm-2 control-label">是否正常营业</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <label class="radio-inline">
            <input type="radio" name="isbusine" value="1" {if $item['isbusine']==1}checked{/if} />是
        </label>
        <label class="radio-inline">
            <input type="radio" name="isbusine" value="0" {if $item['isbusine']==0}checked{/if}/> 否
        </label>
        {else}
        <div class="form-control-static">
            {if $item['isbusine']==0}
            否
            {elseif $item['isbusine']==1}
            是
            {/if}
        </div>
        {/if}
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label">是否显示</label>
    <div class="col-sm-8">
        {ifp 'mendian.edit'}
        <label class="radio-inline">
            <input type="radio" name="status" value="1" {if $item['status']==1}checked{/if} />是
        </label>
        <label class="radio-inline">
            <input type="radio" name="status" value="0" {if $item['status']==0}checked{/if}/> 否
        </label>
        {else}
        <div class="form-control-static">
            {if $item['status']==0}
            否
            {elseif $item['status']==1}
            是
            {/if}
        </div>
        {/if}
    </div>
</div>

<script>
    $('#sel-platform').change(function(){
        var _this = $('#sel-industry');
        $.post("{php echo webUrl('mendian/inajax')}", {pid: $(this).val()}, function (data) {
            _this.empty();
            if (data.status == 1) {
                var json = data.result.data;
                var _html = '';
                for (var o in json) {
                    _html += '<option value="' + json[o].id + '" >' + json[o].name + '</option>';
                }
                _this.html(_html);

            }

        }, 'json')

    })
</script>